package com.mycompany.myapp;

import java.sql.SQLException;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.google.gson.Gson;

@Controller
public class GetTodoController {
	@RequestMapping(value = "/GetTodo", method = RequestMethod.GET)
	public String GetTodo(int pky, Model model) throws ClassNotFoundException, SQLException{
		Gson gson = new Gson();
		TodoDAO dao = new TodoDAO();
		Todo ret = dao.get(pky);
		model.addAttribute("message", gson.toJson(ret));
		return "GetTodo";
	}
}
